import {useSelector, useDispatch} from 'react-redux'
import {add} from '../../store/modules/arrStore'
function CountList(props) {
    const {countArr} = useSelector(state => {
       return state.arrStore
    })
    const dispath = useDispatch()
    function clickAdd() {
        const state = add(1)
        // 告诉store，你要修改数据源
        dispath(state)
    }
    return (
        <div>
            <ul>
            {countArr.map((item, index) => (<li key={index}>{item}</li>))}
            </ul>
            <button onClick={clickAdd}>增加</button>
        </div>
    )
}   

export default CountList